package com.itheima.d3_annotation;

import org.testng.annotations.Test;

import java.lang.reflect.Method;
import java.util.Arrays;

public class AnnotationTest3 {
    @Test
    public void parseCLass(){
        //1、先得到CLass对象
        Class c=Demo.class;
        //2.解析类中的注解
        if(c.isAnnotationPresent(MyTest4.class)){
            MyTest4 myTest4=(MyTest4) c.getAnnotation(MyTest4.class);

            System.out.println(myTest4.value());
            System.out.println(myTest4.aaa());
            System.out.println(Arrays.toString(myTest4.bbb()));
        }
    }

    @Test
    public void parseMethod() throws Exception {
        //1、先得到CLass对象
        Class c=Demo.class;
        Method m=c.getDeclaredMethod("test1");
        //2.解析类中的注解
        if(m.isAnnotationPresent(MyTest4.class)){
            MyTest4 myTest4=(MyTest4) m.getAnnotation(MyTest4.class);

            System.out.println(myTest4.value());
            System.out.println(myTest4.aaa());
            System.out.println(Arrays.toString(myTest4.bbb()));
        }
    }



}
